﻿#include "mainwindow.h"

#include <QApplication>
// #include <QCoreApplication>
#include <windows.h>

int main(int argc, char *argv[])
{

    QApplication a(argc, argv);
    //建立唯一键
    QString strKey = "fsl_key";
    LPCWSTR wstrKey = (LPCWSTR)strKey.toStdString().c_str();
    HANDLE hMutex = CreateMutex(NULL, FALSE, wstrKey);

    if(GetLastError() == ERROR_ALREADY_EXISTS){
        //实例存在
        if(hMutex){
            CloseHandle(hMutex);
            hMutex = NULL;
        }
        return -1;
    }

    MainWindow w;
    w.show();
    return a.exec();
}
